package states 
{
	import flash.geom.Point;
	import model.MovedObject;
	import statemachine.IState;
	import statemachine.IStateObject;
	
	/**
	 * Движение к источнику энергии
	 * @author vkozhaev
	 */
	public class GoToEnergyStationState extends MovingState implements IState
	{
		public static const NAME:String = "go_to_energy_state";
		private var _energyStCoords:Point;
		public function GoToEnergyStationState(_stateObject:IStateObject,_energyStCoords:Point) 
		{
			var _cellCoords:Point = (_stateObject as MovedObject).cellCoords;
			var dx:int = Util.sign(  _energyStCoords.x-_cellCoords.x);
			var dy:int = Util.sign(  _energyStCoords.y-_cellCoords.y);
			
			
			super(_stateObject, new Point(dx, dy));
			
			this._name = NAME;
			this._energyStCoords = _energyStCoords;
			this._ticks = SetParameters.CELL_SIZE;
		}
		
		
		
		public function get energyStCoords():Point {
			return energyStCoords;
		}
		
		override public function doInProcess():void 
		{
			super.doInProcess();
			this._ticks--;
		}
		
	}

}